import binarySearchTree.BinarySearchTree;
import demo.HashBuck;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.put(1,11);
        hashBuck.put(2,22);
        hashBuck.put(3,33);
        hashBuck.put(9,99);

        System.out.println(hashBuck.get(2));
    }
    public static void main3(String[] args) {
        Set<String> set = new TreeSet();
        set.add("sunny");
        set.add("hello");
        set.add("the");
        System.out.println(set);
        Iterator<String> it = set.iterator();
        while(it.hasNext()){
            System.out.println(it.next());
        }
    }
    public static void main2(String[] args) {
        TreeMap<String,Integer> map = new TreeMap<>();
        map.put("sunny",3);
        map.put("the",5);
        map.put("hello",2);
        //通过key获取val值
        Integer val = map.get("the");
        Integer val2 = map.getOrDefault("the2",666);
        System.out.println(val2);
        Set<String> set = map.keySet();
        System.out.println(set);
    }

    public static void main1(String[] args) {
        BinarySearchTree binarySearchTree = new BinarySearchTree();
        int[] arr = {4,17,2,11,6,3,15};
        for (int i = 0; i < arr.length; i++) {
            binarySearchTree.insert(arr[i]);
        }
        binarySearchTree.remove(11);
        System.out.println("=====");
    }
}
